import random
import json

def generate_test_cases(num_cases=10):
    test_cases = []
    for _ in range(num_cases):
        # 随机生成硬币面额，确保至少有一个1以便有可能组成金额
        coins = sorted(list(set([1] + [random.randint(2, 20) for _ in range(random.randint(1, 5))])))
        amount = random.randint(0, 100)
        test_cases.append({"coins": coins, "amount": amount})
    return test_cases

def save_test_cases(test_cases, filename="test_cases.json"):
    with open(filename, 'w') as f:
        json.dump(test_cases, f, indent=4)

if __name__ == "__main__":
    test_cases = generate_test_cases(10)
    save_test_cases(test_cases)
    print("Test cases generated and saved to test_cases.json")